home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / -archivi / -recent2 / arexxcomm.lha / ARexxComm-simple.e < prev    next >
Text File  |  1999-03-21  |  1KB  |  36 lines

  1. /* ARexxComm-simple - a program to demo the BASICS of using ARexxComm! */
  2.  
  3. MODULE 'CSH/arexxcomm'
  4.  
  5. PROC main() HANDLE
  6.  DEF myport=NIL:PTR TO rxcom        ->note we initialised the object pointer to NIL (useful for NILCHECK switch on EC)
  7.  
  8.     WriteF('ARexxComm-simple program\n')
  9.  
  10.     NEW myport.createPort('ExamplePortName3',{myport})        ->try to create our port
  11.     IF myport
  12.         IF myport.portExists('REXX')=FALSE
  13.             ->Rexx Master's port does not exist
  14.             WriteF('You are not running Rexx Master, so this demo won''t work.  Please run it first!\n')
  15.         ELSE
  16.             ->send a messages
  17.             myport.sendRexxMsg('REXX','"Say ''Hi!''"')            ->note that '' inside a string represents a single ' in reality
  18.             WriteF('Sent "Say ''Hi''" message to Rexx Master!\n')
  19.  
  20.             ->send another message
  21.             myport.sendRexxMsg('REXX','"ADDRESS COMMAND ''list SYS:''"')
  22.             WriteF('Sent "ADDRESS COMMAND ''list SYS:''" message to Rexx Master!\n')
  23.  
  24.             Delay(100)
  25.         ENDIF
  26.  
  27.         END myport    ->don't forget to close our port
  28.     ELSE
  29.         WriteF('I failed to open a port named "ExamplePortName".\n')
  30.     ENDIF
  31. EXCEPT
  32.     WriteF('ERROR:  Oh no!  We had the error "\s"!\n',exceptioninfo)
  33.  
  34.     IF myport THEN END myport   ->only close port if it has not been closed already
  35. ENDPROC
  36.